"use strict";


const Joi = require('joi');
const CheckUtil = require("../utils/check");
const BasicsCtl = require("../basics/clz/basectl");
const HomeImpl = require("../service/home");

class HomeCtl extends BasicsCtl {

  constructor(context) {
    super(context);
    this.homeImpl = new HomeImpl(this.cloud);
  }


  /**
   * 添加埋点
   */
  async addTrack() {
    const rules = {
      data: Joi.object().required()
    };
    CheckUtil.validate(rules, this.params);
    let { data, mixNick } = this.params;
    if (!data.userId || data.userId == "") {
      data.userId = mixNick;
    }
    return await this.homeImpl.addTrack(data);
  }

}
module.exports = HomeCtl;